#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

long long N;
int ans, times;

bool checkTop(int num)
{
	int oe = 1;
	while (num > 10)
	{
		num /= 10;
		oe++;
	}
	times = oe;
	return (num % 2 == 0 && oe % 2 == 0) || (num % 2 != 0 && oe % 2 != 0) ? true : false;
}

void test()
{
	cin >> N;
	vector<bool> dp(N + 1);
	dp[0] = 0;
	for (int i = 1; i <= 10; i += 2)
		if (i % 2)
			dp[i] = 1, ans++;

	for (int i = 10; i <= N;)
	{
		bool top = checkTop(i);
		if (!top)
		{
			i += pow(10, times - 1);
			continue;
		}
		dp[i] = top && dp[i % (int)pow(10, times - 1)];

		if (dp[i]) ans++;
		i++;
	}
	cout << ans;
}

int main()
{
	test();
	return 0;
}